<#import "../tpl/pageTep.ftl" as page>
<div class="expand"></div>
<div class="pic-box">
    <img src="" alt="" class="pic" >
</div>

<@page.pageBase currentMenu="股东审批">
<style>
    .form-horizontal .controls {
        line-height: 40px;
        height: 40px;
        margin-left: 3px;
    }

    .button-primary {
        margin-left: -10px;
    }

    .button-danger {
        margin-left: -25px;
    }
</style>
<!--suppress ALL -->
<form id="searchForm" class="form-panel" action="${basepath}/rest/manage/partnerapply/selectPartnerApplyPage">
    <ul class="panel-content">
        <li>
            <div class="control-group span5">
                <div class="search-controls  controls">
                    <input type="text" name="userName" id="userName" value="" placeholder="搜索申请人名字">
                </div>
            </div>
            <div class="form-actions span2">
                <button type="submit" class="button  button-primary">
                    搜索
                </button>
            </div>
        </li>
    </ul>
</form>
<div id="grid"></div>

<#-------------------------------------------------------审核状态 begin-------------------------------------------------------->
<div id="editContent" style="display: none">
    <form id="editForm" class="form-horizontal" action="${basepath}/rest/manage/partnerapply/updatePartnerApply"
          method="post">
        <input type="hidden" class="input-normal control-text" name="id" id="idInput"/>
        <input type="hidden" class="input-normal control-text" name="userID" id="userIDInput"/>

        <div class="row">
            <div class="control-group span16">
                <label class="control-label">审核状态：</label>

                <div class="controls control-row4">
                    <select data-rules="{required:true}" name="status">
                        <option value="">-请选择结果-</option>
                        <option value="pass">通过</option>
                        <option value="unPass">未通过</option>
                    </select>
                </div>
            </div>
        </div>
    </form>
</div>
<#-------------------------------------------------------审核状态 end-------------------------------------------------------->
<script>
    var Grid = BUI.Grid,
            Store = BUI.Data.Store,
            columns = [
                {title: '序号', dataIndex: 'id', elCls: 'center', width: '5%'},
                {title: '申请时间', dataIndex: 'createTime', elCls: 'center', width: '10%'},
                {title: '申请门店', dataIndex: 'storeName', elCls: 'center', width: '20%'},
                {title: '申请人', dataIndex: 'applicant', elCls: 'center', width: '10%'},
                {title: '联系电话', dataIndex: 'phone', elCls: 'center', width: '10%'},
                {
                    title: '审批时间',
                    dataIndex: 'updateTime',
                    elCls: 'center',
                    width: '10%',
                    renderer: function (value) {
                        if (value == null || value == "") {
                            return "————";
                        } else {
                            return value;
                        }
                    }
                },
                {
                    title: '审核', dataIndex: 'id', elCls: 'center', width: '5%', renderer: function (value, data) {
                    switch (data.status) {
                        case 'init':
                            return '<a href="javascript:check(' + value + ',' + data.userID + ')">操作</a>';
                        case 'pass':
                            return '已通过';
                        case 'unPass':
                            return '未通过';
                    }

                }
                }
            ];

    var store = new Store({
                url: '/rest/manage/partnerapply/selectPartnerApplyPage',
                autoLoad: true, //自动加载数据
                params: { //配置初始请求的参数
                    length: '10'
                },
                pageSize: 10,	// 配置分页数目
                root: 'list',
                totalProperty: 'total'
            }),
            grid = new Grid.Grid({
                render: '#grid',
                width: '100%',//如果表格使用百分比，这个属性一定要设置
                columns: columns,
                loadMask: true, //加载数据时显示屏蔽层
                store: store,
                plugins: [Grid.Plugins.CheckSelection], // 插件形式引入多选表格
                // 底部工具栏
                bbar: {
                    pagingBar: true
                }
            }).render();
    /*--------------------------------模糊查询---------------------------------------------*/
    var form = new BUI.Form.HForm({
        srcNode: '#searchForm'
    }).render();

    form.on('beforesubmit', function (ev) {
        //序列化成对象
        var obj = form.serializeToObject();
        obj.start = 0; //返回第一页
        store.load(obj);
        return false;
    });

    /*--------------------------------模糊查询---------------------------------------------*/
    /*--------------------------------审核股东---------------------------------------------*/
    var editForm = new BUI.Form.Form({
        srcNode: '#editForm',
        submitType: 'ajax',
        callback: function (data) {
            if (data.success == true) {
                window.location.href = "${basepath}/rest/manage/account/toPartnerCheck"
            } else {

            }
        }
    }).render();
    var editDialog = new BUI.Overlay.Dialog({
        title: '审批',
        width: 350,
        height: 150,
        contentId: 'editContent',
        success: function () {
            editForm.ajaxSubmit();
        }
    });
    //审核股东
    function check(value, userID) {
        editDialog.show();
        $("#idInput").val(value);
        $("#userIDInput").val(userID);
    }

    /*--------------------------------删除用户---------------------------------------------*/
</script>

</@page.pageBase>
